import React, { Component } from 'react';
import { glabalContext } from './globlData.js'
import ChildGrandson from './childGrandson'
const { Consumer } = glabalContext //代表createContext Consumer(消费者)
class child1 extends Component {
  state = {}
  render () {
    return (<>
      <Consumer>
        {value => (<span>
          {value.admin}
          <button onClick={()=>value.updateAdmin('王总')}>全局修改admin</button>
        </span>)}
      </Consumer>
      <ChildGrandson/>
    </>);
  }
}

export default child1;